<template>
  <div>
    <template v-if="typeof(logis) == 'object'">
      <div class="logistics-msg" @click="show = true">
        <p>{{ logis.logisArr[0].context }}</p>
        <span>{{ logis.logisArr[0].ftime }}</span>
        <h3>查看</h3>
      </div>
    </template>
    <template v-else>
      <div class="logistics-msg">
        <p style="margin: 0;">快递信息{{ logis }}</p>
      </div>
    </template>
    <SlideLeft>
      <div class="wrapper" v-if="show">
        <div class="close" @click="show = false">
          x
        </div>
        <!-- <div class="title">
          <img src="http://localhost:8181/uploads/201910171512053046.jpg" alt="">
          <p>盲盒等2件商品</p>
        </div> -->
        <div class="number">
          <h3>{{ logis.com }}</h3>
          <h5>{{ logis.num }}</h5>
        </div>
        <ul>
          <li v-for="(item, index) of logis.logisArr" :key="index">
            <div class="time">
              <h3>{{ item.day }}</h3>
              <h5>{{ item.time }}</h5>
            </div>
            <div class="msg">
              <!-- <h3>派送中</h3> -->
              <h5>{{ item.context }}</h5>
            </div>
          </li>
        </ul>
      </div>
    </SlideLeft>
  </div>
</template>

<script>
  import SlideLeft from '@/components/slideLeft/SlideLeft.vue'
  export default {
    name: 'Logistics',
    props: ['logis'],
    components: {
      SlideLeft
    },
    data() {
      return {
        status: '',
        show: false
      }
    },
    methods: {
      close() {
        this.$emit('close')
      }
    }
  }
</script>

<style lang="scss" scoped>
  @import '@/assets/css/base.scss';
  .logistics-msg {
    position: relative;
    padding: 0.2rem;
    background: #fff;
    margin-bottom: 0.2rem;
    p {
      margin-bottom: 0.1rem;
      font-size: 0.24rem;
    }
    span {
      font-size: 0.2rem;
      color: $colorGray;
    }
    h3 {
      position: absolute;
      right: 0.2rem;
      bottom: 0.2rem;
      font-size: 0.2rem;
      color: $colorGray;
    }
  }
  .wrapper {
    position: fixed;
    top: 0;
    left: 0;
    padding-top: 0.2rem;
    padding-bottom: 0.6rem;
    width: 100%;
    height: 100vh;
    background: #eee;
    overflow-y: scroll;
    z-index: 3;
    .title {
      background: #fff;
      padding: 0.2rem;
      text-align: center;
      img {
        width: 1.5rem;
        height: 1.5rem;
        border-radius: 5px;
      }
      p {
        font-size: 0.28rem;
      }
    }
    .number {
      display: flex;
      align-items: center;
      margin-top: 0.2rem;
      padding: 0.2rem;
      background: #fff;
      h3 {
        flex: 0 0 1.5rem;
        width: 1.5rem;
        font-size: 0.28rem;
      }
      h5 {
        flex: 1;
        font-size: 0.28rem;
      }
    }
    ul {
      margin-top: 0.2rem;
      background: #fff;
      li {
        display: flex;
        padding: 0.2rem;
        .time {
          flex: 0 0 1rem;
          margin-right: 0.4rem;
          text-align: right;
          color: $colorGray;
          h3 {
            font-size: 0.28rem;
            line-height: 0.36rem;
          }
          h5 {
            font-size: 0.24rem;
            line-height: 0.32rem;
          }
        }
        .msg {
          flex: 1;
          h3 {
            font-size: 0.28rem;
            line-height: 0.36rem;
          }
          h5 {
            font-size: 0.24rem;
            line-height: 0.32rem;
          }
        }
      }
    }
    .close {
      position: absolute;
      top: 0.6rem;
      right: 0.2rem;
      width: 0.4rem;
      height: 0.4rem;
      line-height: 0.4rem;
      text-align: center;
      background: rgba(0, 0, 0, 0.5);
      border-radius: 50%;
      font-size: 0.2rem;
      color: #fff;
    }
  }
</style>
